home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ASME's Mechanical Engine…ing Toolkit 1997 December
/
ASME's Mechanical Engineering Toolkit 1997 December.iso
/
ai
/
pdproprg.lzh
/
DIF.PRO
< prev
next >
Wrap
Text File
|
1985-12-31
|
640b
|
25 lines
/*
This program performs symbolic differentiation.
Sample forms to differentiate:
?-d(x+1,x,X).
?-d(x*x-2,x,X).
See C & M for more on this.
*/
?-op( 9, fx, '%' ).
d(X,X,1) :- !.
d(C,X,0) :- atomic(C).
d(%U, X, %A) :- d( U, X, A ).
d( U+V, X, A+B) :- d(U,X,A), d(V,X,B).
d( U-V, X, A-B ) :- d(U,X,A), d(V,X,B).
d(C*U,X,C*A) :- atomic(C), C \= X, d(U,X,A), !.
d(U*V,X,B*U+A*V) :- d(U,X,A), d(V,X,B).
d(U/V,X,A) :- d(U*V**(%1),X,A).
d(U**V,X,V*W*U**(V-1)) :- atomic(V), c \= X, d(U,X,W).
d(log(U),X,A*U**(%1)) :- d(U,X,A).